package com.bz.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bz.dao.IntroduceDao;
import com.bz.entity.IntroduceEntity;
import com.bz.model.AboutUsDto;
import com.bz.service.IAboutUsService;

@Service
public class AboutUsServiceImpl implements IAboutUsService {

    @Autowired
    private IntroduceDao introduceDao;

    @Override
    public AboutUsDto get() {
        AboutUsDto aud = new AboutUsDto();
        LambdaQueryWrapper<IntroduceEntity> query = new LambdaQueryWrapper<>();
        query.orderByDesc(IntroduceEntity::getUpdateDate).last("limit 0,1");
        IntroduceEntity db = introduceDao.selectOne(query);
        if (null == db) {
            return aud;
        }
        aud.setImg(db.getImg());
        aud.setContent(db.getContent());
        return aud;
    }

}
